/* Turska Framework/UI library (Turs2)
 * Copyright 2003-2010 Jetro Lauha
 * All rights reserved.
 * Web: http://iki.fi/jetro/turska/
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of EITHER:
 *   (1) The GNU Lesser General Public License as published by the Free
 *       Software Foundation; either version 2.1 of the License, or (at
 *       your option) any later version. The text of the GNU Lesser
 *       General Public License is included with this library in the
 *       file LICENSE-LGPL.txt.
 *   (2) The BSD-style license that is included with this library in
 *       the file LICENSE-BSD.txt.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
 * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
 *
 * $Id: T2IMGUITextFieldStyle.h 157 2010-01-01 23:31:43Z jlauha $
 * $Revision: 157 $
 */

#ifndef T2IMGUITEXTFIELDSTYLE_H_INCL
#define T2IMGUITEXTFIELDSTYLE_H_INCL


namespace turska
{
    //! IMGUI text field style interface.
    class IMGUITextFieldStyle : public IMGUIWidgetStyle
    {
    public:
        virtual ~IMGUITextFieldStyle() {}

        //! Returns true if x,y is inside given rectangle.
        /*! If rectangle width or height is 0 then the style object should
         *  either know the proper size by itself.
         * \param imgui reference to the current IMGUI object.
         * \param x X-coordinate to check for.
         * \param y Y-coordinate to check for.
         * \param area rectangle to check x,y against.
         */
        virtual bool isInside(const IMGUI &imgui, TREAL x, TREAL y,
                              const Rectangle &area) = 0;

        //! Returns true if given character is allowed in this textfield.
        virtual bool isCharAllowed(UI32 character) = 0;

        //! Renders a button or a checkbox and returns covered area dimensions.
        /*! Implementation should check from IMGUI that rendering is enabled,
         *  or return without rendering anything if it is disabled.
         * \param imgui reference to the current IMGUI object.
         * \param widgetState one of the states from IMGUI_WIDGET_STATE.
         * \param x X-coordinate of top-left corner.
         * \param y Y-coordinate of top-left corner.
         * \param width width of the button, or 0 if style should know it.
         * \param height height of the button, or 0 if style should know it.
         * \param text text to print, or 0 if none given.
         * \return area covered by the render call.
         */
        virtual Rectangle render(const IMGUI &imgui, I32 widgetState,
                                 TREAL x, TREAL y, TREAL width, TREAL height,
                                 const C8 *text) = 0;
    };

} // namespace turska


#endif // !T2IMGUITEXTFIELDSTYLE_H_INCL
